package com.pai4j.act.service;
import com.pai4j.act.repository.entity.ResourceBehaviorEntity;
import org.springframework.stereotype.Service;

/**
 *  单向（不支持取消操作）互动服务: 浏览、预览、举报、投诉等
 *
 * @author: CYM-pai
 * @date: 2025/07/13 18:44
 **/
@Service
public class OneWayResourceBehaviorService extends AbstractResourceBehaviorService {


   
    /**
     * 执行行为逻辑
     *
     * @param userId 用户ID
     * @param resourceType 资源类型
     * @param resourceId 资源ID
     * @return 执行结果，返回true表示执行成功
     */
    @Override
    protected boolean doBehavior(String userId, String resourceType, Long resourceId) {

        ResourceBehaviorEntity resourceBehavior = new ResourceBehaviorEntity();
        resourceBehavior.setUserId(userId);
        resourceBehavior.setBehaviorType(super.behaviorType);
        resourceBehavior.setResourceType(resourceType);
        resourceBehavior.setResourceIndex(resourceId);
        resourceBehavior.setStatus(true);
        super.resourceBehaviorDAO.save(resourceBehavior);
        return true;
    }
}
